<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport"
    content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <title>Document</title>

  <style>
    #myInput {
      width: 400px;
      height: 50px;
      font-size: 40px;
      color: red;
    }

    #contain {
      margin-top: 20px;
      width: 400px;
      height: 200px;
      border: 1px solid salmon;
    }
  </style>
</head>

<body>
  <input id="myInput" type="text" />
  <div id="contain"></div>

  <script>
    var text;
    window.data = {};
    var oIn = document.getElementById("myInput");
    var oDiv = document.getElementById("contain");

    oIn.addEventListener("input", function (e) {
      text = e.target.value;
      console.log(text);
      window.data.value = text;
    });
    Object.defineProperty(window.data, "value", {
      get() {
        return "";
      },
      set(v) {
        oDiv.innerHTML = v;
      },
    });
  </script>
</body>

</html>